package parser;
import antlr.RecognitionException;
import antlr.Token;
import java.util.List;

class MultAsgnStmt extends Stmt {
    
    List<Expr> left;
    List<Expr> right;
    
    MultAsgnStmt(List<Expr> left, List<Expr> right) throws RecognitionException {
        this.left = left;
        this.right = right;
    }
     
    void write(ByteStream out) throws RecognitionException {
        out.line(line);
        int size = left.size();
        if (size < 4) {
            for (Expr e: right)
                e.write(out);
            if (size == 2) {
                out.write(Opcodes.SWAP);
            } else if (size == 3) {
                out.write(Opcodes.FLIP3);
            }
            for (Expr e: left)
                e.writeLHS(out);
        } else {
            new Tuple(right).write(out);
            new Tuple(left).writeLHS(out);
        }
    }
    
}
